#!/bin/bash
function deleteJar(){
    echo "删除备份包开始"
    rm -rf /data/jar/helmet_$1.jar_bak
    mv /data/jar/helmet_$1.jar /data/jar/helmet_$1.jar_bak
    echo "删除备份包结束"
}
function mvName(){
   deleteJar $1
   echo "修改jar包名字开始"
   mv /data/jar/sits-helmet-$1-impl-0.0.1-SNAPSHOT.jar /data/jar/helmet_$1.jar
   echo "修改名字结束"
   pushJar $1
   
}
function pushJar(){
     echo "重启容器开始"
     docker restart helmet_$1
     echo "重启容器结束"
    
}
echo "======自动发包脚本开始======="
#rz
echo "请输入需要发的工程"
echo "1:helmet-operate"
echo "2:helmet-report"
echo "3:helmet-base"
read code
if [ ${code} == 1 ]; then
    echo "这是operate"
    mvName "operate"
elif [ ${code} == 2 ]; then
     echo "这是report"
     mvName "report" 
elif [ ${code} == 3 ]; then
     echo "这是base"
     mvName "base" 
else
     echo "你输入的什么东西回去重新输入去"
fi
